home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_200 / 295_01 / bexit.c < prev    next >
Text File  |  1989-12-28  |  953b  |  45 lines

  1. /*    Copyright (c) 1989 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /* #ident    "bexit.c    1.2 - 89/10/31" */
  5.  
  6. #include <errno.h>
  7. /*#include <stdlib.h>*/
  8. #include "blkio_.h"
  9.  
  10. /*man---------------------------------------------------------------------------
  11. NAME
  12.      bexit - block file exit
  13.  
  14. SYNOPSIS
  15.      #include <blkio.h>
  16.  
  17.      void bexit(status)
  18.      int status;
  19.  
  20. DESCRIPTION
  21.      The bexit function is for use with the blkio library in place of
  22.      exit.  It closes all open block files, which writes the contents
  23.      of the buffers to the files, then calls exit.
  24.  
  25. SEE ALSO
  26.      bclose.
  27.  
  28. ------------------------------------------------------------------------------*/
  29. void bexit(status)
  30. int status;
  31. {
  32.     BLKFILE *bp = NULL;
  33.  
  34.     /* close all open block files */
  35.     for (bp = biob; bp < (biob + BOPEN_MAX); bp++) {
  36.         if (bp->flags & BIOOPEN) {
  37.             if (bclose(bp) == -1) {
  38.                 BEPRINT;
  39.             }
  40.         }
  41.     }
  42.  
  43.     exit(status);
  44. }
  45.